<script setup lang="ts">
definePageMeta({
  title:'代买域名列表',
  layout:'admin'
})
import {HANDLE_STATUS, PAY_STATUS} from "~/const/common";
const form=reactive({
  limit:20,
  page:1,
  name:'',//模糊搜索-域名
});
const {data:list,refresh}=await useServerGet('/agent/getOrderList',form)
const search=()=>{
  refresh&&refresh();
}
</script>

<template>
<div>
  <el-card>
    <div class="flex">
      <div class="w-52 mr-2">
        <el-input placeholder="请输入域名" v-model="form.name" class="w-40" clearable></el-input>
      </div>
      <div class="w-20">
        <el-button type="primary" @click="search">搜索</el-button>
      </div>
    </div>
  </el-card>
  <el-card class="mt-4">
    <el-table :data="list.data.list" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}" class="h-[620px] overflow-auto">
      <el-table-column prop="id" label="ID"></el-table-column>
      <el-table-column prop="domain" label="域名" min-width="150"></el-table-column>
      <el-table-column label="长度">
        <template #default="{row}">
          <span>{{row.domain.endsWith('.com.cn')?row.domain.split('.').slice(0,-2).join('.').length:row.domain.split('.').slice(0,-1).join('.').length}}</span>
        </template>
      </el-table-column>
<!--      <el-table-column prop="goods.synopsis" label="域名简介"></el-table-column>-->
      <el-table-column prop="money" label="价格"></el-table-column>
      <el-table-column prop="fee" label="平台费用"></el-table-column>
      <el-table-column prop="created_at" label="交易时间"></el-table-column>
      <el-table-column prop="goods.register_time" label="域名注册时间"></el-table-column>
      <el-table-column prop="goods.expiration_time" label="域名到期时间"></el-table-column>
      <el-table-column prop="state" label="支付状态">
        <template #default="{row}">
          {{PAY_STATUS[row.pay_status]}}
        </template>
      </el-table-column>
      <el-table-column prop="state" label="交易状态">
        <template #default="{row}">
          {{HANDLE_STATUS[row.handle_status]}}
        </template>
      </el-table-column>
    </el-table>
    <MyPage v-model:page="form.page" v-model:perpage="form.limit" v-model:total="list.data.total" @change="refresh"></MyPage>
  </el-card>
</div>
</template>

<style scoped lang="scss">

</style>